let {setFeedback} = require('../../../api/programs/feedback')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    valueText:'',
    valueTitle:'',
  },
  onChangeTitle(e){
    this.setData({
      valueTitle:e.detail
    })
  },
  onChangeText(e){
    this.setData({
      valueText:e.detail
    })
  },
  onSubmit(){
    if (this.data.valueText !== '' && this.data.valueTitle !== '') {
      setFeedback({
        content:this.data.valueText,
        name:this.data.userInfo.jname,
        title:this.data.valueTitle,
        phone:this.data.userInfo.phone
      }).then(res=>{
        wx.showToast({
          title: '提交成功，感谢您的反馈',
          icon:'none'
        })
        setTimeout(() => {
          wx.navigateBack({
            detal:1
          })
        }, 1000);
      })
    }else {
      return wx.showToast({
        title: '请输入完整建议及标题',
        icon:'none'
      })
    }
  },
  onLoad(options) {
    this.setData({
      userInfo:wx.getStorageSync('userInfoMy')
    })
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },
})